//添加权限
function addPow() {
    var num=$("#addBody").children().length+1;
    var newName=$("#rolename").val();
    var newFile=$("#rolefile").val();
    
    $.ajax({
        url:"../videoCourse_stu/server/powAdd.php",
        type:"post",
        data:{num,
            newName,
            newFile},
        dataType:"json",
    }).done((result)=>{
        console.log(result);
        if(result.success){
            var str=`<tr>
                <th>${num}</th>
                <td>${newName}</td>
                <td>${newFile}</td>
                <td>
                    <button type="button" class="btn btn-primary btn-sm" data-toggle="modal"
                        data-target="#settingRole">更新</button>
                </td>
            </tr>`;

            $("#addBody").append(str);
        }else{
            alert("添加失败");
        }
    });
}


//添加新角色
function addRole() {
    var num=$("#addRole").children().length+1;
    console.log(num);
    var newName=$("#partname").val();
    console.log(newName);
    

    var str=`<tr>
                <th>1</th>
                <td>超级管理员</td>
                <td>
                    <ul class="list-unstyled mb-0">
                        <li>视频统计</li>
                        <li>权限管理</li>
                        <li>课程管理</li>
                        <li>老师管理</li>
                        <li>视频管理</li>
                    </ul>
                </td>
                <td>
                    <button type="button" class="btn btn-primary btn-sm" data-toggle="modal"
                        data-target="#settingPart">更新</button>
                </td>
            </tr>`;

    $("#addBody").append(str);
}